/*  1:   */ package com.atomikos.icatch.imp;
/*  2:   */ 
/*  3:   */ import com.atomikos.icatch.HeurHazardException;
/*  4:   */ import com.atomikos.icatch.HeuristicMessage;
/*  5:   */ import com.atomikos.icatch.Participant;
/*  6:   */ import com.atomikos.icatch.RollbackException;
/*  7:   */ import com.atomikos.icatch.StringHeuristicMessage;
/*  8:   */ 
/*  9:   */ class PrepareMessage
/* 10:   */   extends PropagationMessage
/* 11:   */ {
/* 12:   */   public PrepareMessage(Participant participant, Result result)
/* 13:   */   {
/* 14:45 */     super(participant, result);
/* 15:   */   }
/* 16:   */   
/* 17:   */   protected Object send()
/* 18:   */     throws PropagationException
/* 19:   */   {
/* 20:57 */     Participant part = getParticipant();
/* 21:58 */     int ret = 0;
/* 22:59 */     Boolean result = null;
/* 23:   */     try
/* 24:   */     {
/* 25:61 */       ret = part.prepare();
/* 26:62 */       if (ret == 0) {
/* 27:63 */         result = null;
/* 28:   */       } else {
/* 29:65 */         result = new Boolean(true);
/* 30:   */       }
/* 31:   */     }
/* 32:   */     catch (HeurHazardException heurh)
/* 33:   */     {
/* 34:67 */       throw new PropagationException(heurh, false);
/* 35:   */     }
/* 36:   */     catch (RollbackException jtr)
/* 37:   */     {
/* 38:70 */       result = new Boolean(false);
/* 39:   */     }
/* 40:   */     catch (Exception e)
/* 41:   */     {
/* 42:73 */       StringHeuristicMessage shm = new StringHeuristicMessage("Possibly heuristic participant: " + part.toString());
/* 43:   */       
/* 44:75 */       HeuristicMessage[] msgs = new HeuristicMessage[1];
/* 45:76 */       msgs[0] = shm;
/* 46:77 */       HeurHazardException heurh = new HeurHazardException(msgs);
/* 47:78 */       throw new PropagationException(heurh, false);
/* 48:   */     }
/* 49:81 */     return result;
/* 50:   */   }
/* 51:   */   
/* 52:   */   public String toString()
/* 53:   */   {
/* 54:86 */     return "PrepareMessage to " + getParticipant();
/* 55:   */   }
/* 56:   */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\transactions\3.7.0\transactions-3.7.0.jar
 * Qualified Name:     com.atomikos.icatch.imp.PrepareMessage
 * JD-Core Version:    0.7.0.1
 */